package logic

import (
	"context"

	"user/user_api/internal/svc"
	"user/user_api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type SmsCaptchaLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewSmsCaptchaLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SmsCaptchaLogic {
	return &SmsCaptchaLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *SmsCaptchaLogic) SmsCaptcha(req *types.SmsCaptchaRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	captcha, err := l.SmsCaptcha(&types.SmsCaptchaRequest{UserMobile: req.UserMobile})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: err.Error(),
			Dara:    nil,
		}, nil
	}
	return &types.Response{
		Code:    200,
		Message: "",
		Dara:    captcha,
	}, nil
}
